<template>
  <div class="gallery" @click="hanleGalleryClick">
    <div class="gallery-wrapper">
      <swiper :options="swiperOption">
        <!-- slides -->
        <swiper-slide>
          <img class="swiper-img" src="http://img1.qunarzz.com/sight/p0/1802/ed/ed72888fae17fa4ca3.water.jpg_r_800x800_154901a9.jpg">
        </swiper-slide>
        <swiper-slide>
          <img class="swiper-img" src="http://img1.qunarzz.com/sight/p0/1803/5e/5e5cf1907207dd16a3.water.jpg_r_800x800_babf93e6.jpg">
        </swiper-slide>
        <swiper-slide>
          <img class="swiper-img" src="http://img1.qunarzz.com/sight/p0/1803/99/997267e601497ed1a3.water.jpg_r_800x800_1e3dbd90.jpg">
        </swiper-slide>
        <!-- Optional controls -->
        <!-- <div class="swiper-pagination" slot="pagination"></div> -->
      </swiper>
    </div>
  </div>
</template>

<script>
export default{
  name: 'CommonGallery',
  data () {
    return {
      swiperOption: {
        observer: true,
        observeParents: true,
        loop: true
      }
    }
  },
  methods: {
    hanleGalleryClick () {
      this.$emit('close')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .gallery
    z-index: 2
    position: absolute
    top: 0
    right: 0
    bottom: 0
    left: 0
    background-color: #000000
    display: flex
    flex-direction: column
    justify-content: center
    .gallery-wrapper
      background-color: #fff;
      height: 0
      overflow: hidden
      width: 100%
      padding-bottom: 60.8%
      .swiper-img
        width: 100%
</style>
